0 CLEAR200:DIMNT(11),BD(7,7),AV(64),CC,CA,RV,T,M$,MC,C(7):MC=16384:RV=64:GOTO15
5 CA=(PEEK(384)AND1)*256+PEEK(385):PRINTM$;:CC=((PEEK(384)AND1)*256+PEEK(385))-1
6 FORT=CA+MCTOCC+MC:POKET,PEEK(T)-RV:NEXT:RETURN
10 DATA 49,51,53,54,56,58,60,61
15 CLS:GOSUB4000:PRINT@480+4,"PRESS ANY KEY TO CONTINE";
20 I$=INKEY$:R=RND(1000):IFI$=""THEN20
30 FORN=0TO7:READNT(N):NEXT
40 CLS:PRINTTAB(7);"THE GAME OF MAXIT"
50 PRINT"DO YOU WANT INSTRUCTIONS?";:GOSUB3000:PRINT
60 IFKS$="Y"THENGOSUB2210
1180 PRINT"1 OR 2 PLAYERS?";:GOSUB3000
1190 PRINTKS$:NP=VAL(KS$):PRINT
1200 IFNP=1THEN1240
1210 IFNP<>2THEN1180
1220 INPUT"WHAT IS YOUR NAME #1";P1$:P1$=LEFT$(P1$,7):SOUND100,1:PRINT
1230 INPUT"WHAT IS YOUR NAME #2";P2$:P2$=LEFT$(P2$,7):SOUND100,1:PRINT:GOTO1250
1240 P2$="MC-10":INPUT "WHAT IS YOUR NAME";P1$:SOUND100,1:PRINT:P1$=LEFT$(P1$,7)
1250 CLS0:PRINT"            M A X I T":FX=1:GOSUB2360
1260 MD=1
1270 FORK=1TO64:AV(K)=K:NEXT
1280 FORK=64TO1STEP-1:READPC
1290 P1=1+INT(K*RND(0))
1300 J=AV(P1)-1
1310 IFP1<KTHENFORI=P1TOK-1:AV(I)=AV(I+1):NEXT
1320 I=INT(J/8):J=J-8*I
1330 BD(I,J)=PC:GOSUB1540:NT=J:GOSUB1980
1340 NEXTK:RESTORE:FORZ=1TO8:READIT:NEXT:NT=7:GOSUB1980:GOSUB1980:GOSUB1980
1350 DATA 15,10,9,9,8,8,7,7,7,6,6,6
1360 DATA 5,5,5,5,4,4,4,4,3,3,3,3,3
1370 DATA 2,2,2,2,2,2,1,1,1,1,1
1380 DATA 0,0,0,0,0,0,-1,-1,-1,-1,-1
1390 DATA -2,-2,-2,-2,-3,-3,-3
1400 DATA -4,-4,-4,-5,-5,-6,-6
1410 DATA -7,-9,100
1420 S1=0:S2=0:GOSUB2000
1430 REM PLAYER 1
1440 PL=1:GOSUB1630:IFFL=0THEN1470
1450 REM PLAYER 2
1460 PL=2:GOSUB1630:IFFL<>0THEN1430
1470 ON2+SGN(S2-S1)GOSUB1510,1520,1530
1480 PRINT@480,"DO YOU WANT TO PLAY AGAIN?     ";:C$=""
1485 C$=INKEY$:IFC$=""THEN1485
1490 IFC$="Y"THEN1250
1500 IFC$="N"THENCLS:END
1505 GOTO1485
1510 PRINT@448,P1$;" WON BY";STR$(S1-S2);" POINTS":RETURN
1520 PRINT@448,"IT'S A TIE!":RETURN
1530 PRINT@448,P2$;" WON BY";STR$(S2-S1);" POINTS":RETURN
1540 REM DRAW BOARD POSITION IN REVERSE
1550 PC=BD(I,J)
1560 PRINT@32*(I+2)+J*4+1,"";
1570 IFMD=2THENRV=64:GOTO1590
1580 RV=0
1590 IFPC=100THENM$="**":GOSUB5:C1=I:C2=J:GOTO1620
1600 IFPC=-100THENM$="  ":GOSUB5:GOTO1620
1610 M$=RIGHT$("  "+STR$(PC),2):GOSUB5
1620 RV=0:RETURN
1630 IFPL=2THEN1670
1640 FL=600:FORJ=0TO7:FL=FL+BD(C1,J):NEXT
1650 IFFL=0THENRETURN
1660 NM$=P1$:DX=1:DY=0:GOSUB1700:RETURN
1670 FL=600:FORI=0TO7:FL=FL+BD(I,C2):NEXT
1680 IFFL=0THENRETURN
1690 NM$=P2$:DX=0:DY=1:GOSUB1700:RETURN
1700 Y=C1:X=C2
1710 IFPL=2THENRV=64
1720 IFNP=2ORPL=1THEN1730
1725 GOSUB1970:PRINTLEFT$(NM$+"'S TURN.        ",16);:GOSUB2060:GOTO1880
1730 GOSUB1970:ONFXGOTO1740,1750
1740 PRINT@480+16,"               ";:FX=2
1750 GOSUB1970:PRINTLEFT$(NM$+"'S TURN.        ",16);:POKE16895,96:GOTO1760
1760 FORZ=150TO210STEP10:SOUNDZ,1:NEXT
1770 C$=INKEY$:IFC$=""THEN1770
1780 IFC$="Q"THENEND
1781 KS=ASC(C$)
1790 IFC$<>" "THEN1860
1795 OX=X:OY=Y
1800 Y=Y+DY:IFY>7THENY=0
1810 X=X+DX:IFX>7THENX=0
1820 PT=BD(Y,X):IFABS(PT)=100THEN1800
1830 MD=1:I=OY:J=OX:GOSUB1540
1840 MD=2:I=Y:J=X:GOSUB1540
1850 GOTO1770
1860 IFC$<>CHR$(13)THEN1770
1870 IFABS(BD(Y, X))=100THEN1770
1880 REM SCORE IT
1890 IFNP=1ANDPL=2THENMD=2:I=Y:J=X:GOSUB1540:REM FORDL=1TO1500:NEXT
1900 GOSUB1990:MD=1:I=C1:J=C2:BD(I,J)=-100:GOSUB1540
1910 I=Y:J=X:PT=BD(I,J):BD(I,J)=100:GOSUB1540
1920 IFPL=1THENS1=S1+PT
1930 IFPL=2THENS2=S2+PT
1940 GOSUB1970
1950 PRINT@480+16,LEFT$("LAST TAKEN:"+STR$(PT)+"     ",15);:POKE16895,96
1960 GOSUB2000:RETURN
1970 PRINT@480,"";:RETURN
1980 SOUND220,1:RETURN
1990 FORN=49TO70STEP2:SOUNDN,1:NEXT:RETURN
2000 PRINT@448,"";
2010 ME$=LEFT$(P1$+"="+STR$(S1)+"            ",16)+LEFT$(P2$+"="+STR$(S2)+"         ",16):ME$=LEFT$(ME$,31):PRINTME$:RETURN
2020 REM SCREEN INSTRUCTIONS
2030 RETURN
2040 REM COMPUTER PLAYER ALGORITHM
2060 MT=-100:GG=-1:FORA1=0TO7:PC=BD(A1,C2):IFABS(PC)=100THEN2200
2070 MX=-100:FORA2=0TO7
2080 IFA2<>C2THENPK=BD(A1,A2):IFPK<>-100ANDPK>MXTHENMX=PK:SV=A
2090 NEXTA2
2100 IFMX<>-100THEN2120
2110 IFPC>MTTHENMT=PC:GG=A1:GOTO2200
2120 IFGG<0THENGG=A1
2130 FORA2=0TO7:PQ=BD(A2,SV):IFPQ=-100ORA2=A1THEN2190
2140 MY=-100:FORA3=0TO7:PW=BD(A2,A3):IFA3=SVTHEN2160
2150 IFABS(PW)<>100ANDPW>MYTHENMY=PW
2160 NEXTA3
2170 IFMY=-100THENMY=0
2180 DT=PC-MX+PQ-MY:IFDT>MTTHENMT=DT:GG=A1
2190 NEXTA2
2200 NEXTA1:Y=GG:RETURN
2210 CLS:PRINTTAB(11);:M$="M A X I T":GOSUB5:PRINT
2220 PRINT "THE OBJECT OF MAXIT IS TO GET"
2230 PRINT "AS MANY POINTS AS POSSIBLE. TWO"
2240 PRINT "PLAYERS CAN PLAY AGAINST EACH"
2250 PRINT "OTHER, OR ONE AGAINST THE"
2260 PRINT "COMPUTER. YOU GET POINTS BY"
2270 PRINT "MOVING A MARKER TO A SPACE WITH"
2280 PRINT "A NUMBER IN IT. THE FIRST"
2290 PRINT "PLAYER ALWAYS MOVES HORIZONTALLY";
2300 PRINT "AND THE SECOND MOVES VERTICALLY.";
2310 PRINT "YOU INDICATE THE PLACE YOU WANT"
2320 PRINT "TO MOVE TO BY USING THE space"
2330 PRINT "bar TO POSITION YOURSELF, AND"
2340 PRINT "THEN HIT enter TO TAKE THAT"
2350 PRINT "PIECE.":RETURN
2360 REM  OTHER OTHELLO BOARD
2370 FORZ=0TO7:PRINT@32*(Z+2),"";:FORH=1TO32:PRINTCHR$(C(Z));:NEXT:NEXT
2380 GOSUB2020
2390 RETURN
3000 KS$="":
3010 KS$=INKEY$:IFKS$=""THEN3010:
3020 KS=ASC(KS$):RETURN
4000 PRINT@32*4+6,"";:M$=" -*-   MAXIT    -*- " :GOSUB5
4010 PRINT@32*5+6,"";:M$="(A) BY P. LEABO 3/82":GOSUB5
4020 PRINT@32*6+6,"";:M$="                    ":GOSUB5
4030 PRINT@32*7+6,"";:M$="    ORIGINALLY A    ":GOSUB5
4040 PRINT@32*8+6,"";:M$="   'PET' PROGRAM    ":GOSUB5
4050 C(0)=255:C(1)=159:C(2)=175:C(3)=191:C(4)=207:C(5)=223:C(6)=239:C(7)=255:RETURN
